<?php if(($_GET["success"] == 1) || ($_GET["notice"] == 1)){ ?>
	<div class="redirect_notice"><?php echo $_SESSION['message']; ?></div>
<?php
}

if($_GET["success"] == 1){ ?>
<iframe src="https://vcommission.go2jump.org/SL1cZ?adv_sub=<?php echo $_SESSION['email_id']; ?>" scrolling="no" frameborder="0" width="1" height="1"></iframe>
<?php } ?>

<?php 
	buzzr_fb_like();
	$city = pods_url_variable('last');
	$buzzr_cities = get_buzzr_cities(); 
	$where = "t.camp_end > ".fix_date()." && t.daily=1 && city.name='".$city."'";
?>

<h1  id="f_margin">Daily Deals <?php echo ucwords($city); ?></h1>
<div class="clear"></div>
<div class="filter">
	<div class="city_select">Select City
	 <select name="city_select" onchange="window.location.href = this.value;">
	 	<?php foreach($buzzr_cities as $city_val){
           $citlink = BUZZR_URL.'/dailydeals/'.strtolower($city_val['name']);
           ?>
           <?php if(ucwords($city) == $city_val['name']){?>
           <option value="<?php echo $citlink; ?>" selected="selected"><?php echo $city_val['name']; ?></option>
           <?php }else{?>
	 	<option value="<?php echo $citlink; ?>"><?php echo $city_val['name']; ?></option>
	 	<?php } 
	 	}
	 	?>
	 </select>
  	</div>
	<div class="views">
	  	<a class="grid g-button">Grid View</a>
	  	<a class="list g-button">List View</a>
	</div>
	<div class="sort">Sort by
		<a class="g-button" href="<?php echo BUZZR_URL.'/deals'; ?>">Latest</a>
	  	<a class="g-button" href="<?php echo BUZZR_URL.'/deals-popular'; ?>">Popular</a>
	</div>
   <div class="clear"></div>
</div>

<div id="list_wrap">
<ul class="list">
<?php
$list_view_deal = new Pod('deal');
$list_view_deal->findRecords('id DESC', 50, $where);
echo $list_view_deal->showTemplate('list_grid_daily');
?>
</ul>

</div>
<div class="clear"></div>
<div>
<?php echo $list_view_deal->getPagination(); ?>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){ 

$(':checkbox').click(function(){ 
  var unit_div = $(this).attr('src');
  var checkbox_status = $(this).is(':checked'); 
  var unit_hidden = $('.'+unit_div).is(":hidden");
  //alert(checkbox_status);
  //alert(unit_hidden);
  if(checkbox_status === false && unit_hidden === false){
    $('.'+unit_div).toggle("slow");
  } 
  else if(checkbox_status === true && unit_hidden === true){
    $('.'+unit_div).toggle("slow");
  }
});

});
</script>